﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Linq;

namespace Omnia.DataModels
{
    public class TransactionOfMonthInfo
    {
        public TransactionOfMonthInfo() { }

        public TransactionOfMonthInfo(IEnumerable<TransactionInfo> transactions)
        {
            if (transactions.Count() > 0)
            {
                Sum = transactions.Sum(t => t.Amount);
                LastUpdate = transactions.OrderByDescending(t => t.Time).FirstOrDefault().Time;
                Count = transactions.Count();
            }
        }

        public double Sum { get; set; }
        public int Count { get; set; }
        public DateTime LastUpdate { get; set; }
    }
}
